<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>侦听器-获取对象原值成功</title>
  <script src="vue.js"></script>
</head>
<body>
  <script>
    let circle = {
      position: {
        x:0, y:0
      },
      radius: 10
    }
    let vm = new Vue({
      data: circle,
      computed:{
        computedPosition(){
          return JSON.parse(JSON.stringify(this.position));
        }
      },
      watch: {
        computedPosition: {
          handler(newValue, oldValue) {
            console.log(`位置从 (${oldValue.x},${oldValue.y}) 变化到了 (${newValue.x},${newValue.y})`);
          },
          deep: true
        }
      }
    });
    vm.position.x = 3; 
  </script>
</body>
</html>
